package com.modemMgr.excel;

import java.math.BigDecimal;

import org.apache.poi.ss.usermodel.Cell;

public class ExcelUtil {
	public static final String getValueAsString(Cell cell)
	{
		if (null == cell)
		{
			return "";
		}
		String cellValue;
		switch (cell.getCellType()) {
		case Cell.CELL_TYPE_NUMERIC:
			cellValue = new BigDecimal(cell.getNumericCellValue()).toPlainString();
			break;
		case Cell.CELL_TYPE_STRING:
			cellValue = cell.getStringCellValue();
			break;
		case Cell.CELL_TYPE_FORMULA:
			cellValue = cell.getCellFormula();
			break;
		case Cell.CELL_TYPE_BLANK:
			cellValue = "";
			break;
		default:
			cellValue = "";
			break;
		}
		
		return cellValue;
	}
}
